package com.concurrent.coline.part7;

import java.util.concurrent.atomic.AtomicInteger;

/**
 *类说明：AtomicInt
 */
public class UseAtomicInt {
	
	static AtomicInteger ai = new AtomicInteger(10);
	
    public static void main(String[] args) {
        //10--->11
    	System.out.println(ai.getAndIncrement());
    	//11-->10
    	System.out.println(ai.getAndDecrement());
        //10--->11
    	System.out.println(ai.incrementAndGet());
    	//11-->10
        System.out.println(ai.decrementAndGet());
        System.out.println(ai.get());
        System.out.println(ai.compareAndSet(11,10));
        System.out.println(ai.compareAndSet(10,10));
    }
}
